<template>
	<view class="order-action bg-color-pageBg">
		<view class="order-action-container plr-16 flex flex-ai-center flex-js-sb">
			<w-button type="colorful" v-if="order.order_status==1" shape="circle" style='width: 260rpx;' :pain="true"
				@click='toMycollection'>继续寄售</w-button>
			<w-button v-if="order.order_status==1" type="colorful" shape="circle" style='width: 400rpx;' @click='viewProduct'>查看商品</w-button>
			<w-button v-else type="colorful" shape="circle" style='width: 100%;' @click='toMycollection'>去寄售其他藏品</w-button>
		</view>
	</view>
</template>

<script>
	import PayUtil from '@/utils/payUtil.js'
	import {
		changeOrderStatus
	} from '@/api/order/index.js'
	export default {
		props: {
			order: {
				type: Object,
				default () {
					return {

					}
				}
			}
		},
		data() {
			return {

			}
		},
		methods: {
			toMycollection() {
				let  isApp=uni.getStorageSync('app');
				if(isApp){
					let isIos = window.localStorage.getItem('ios')
					let action = JSON.stringify({
						action:"gotoActivity",
						params:{
							pageKey:'my',
						}
					})
					if (isIos) {
						window.webkit.messageHandlers.callbackHandler.postMessage(action);
					} else {
						Android.webCallback(action)
					}
				}else{
					uni.switchTab({
						url: '/pages/my/my'
					})
				}
			},
			viewProduct(){
				let {sale_user_collection_id,goods_type} =this.order;
				let  isApp=uni.getStorageSync('app');
				if(isApp){
					let isIos = window.localStorage.getItem('ios')
					let action = JSON.stringify({
						action:"gotoActivity",
						params:{
							pageKey:goods_type==2? 'collectionDetails':'boxDetails',
							query:{
								id:sale_user_collection_id
							}
						}
					})
					if (isIos) {
						window.webkit.messageHandlers.callbackHandler.postMessage(action);
					} else {
						Android.webCallback(action)
					}
					
				}else{
					let url='/pages/myCollection/collectionDetails'
					if(goods_type==1){
						url='/pages/blindBox/blindBoxDetails'
					}
					this.$u.route(url,{id:sale_user_collection_id})
				}
			}
		}
	}
</script>

<style lang="scss">
	.order-action {
		position: fixed;
		bottom: 0;
		left: 0;
		width: 750rpx;
		padding-bottom: env(safe-area-inset-bottom);

		&-container {
			height: 120rpx;
		}
	}
</style>
